<%-- 
    Document   : viewBook
    Created on : Oct 9, 2012, 2:12:35 AM
    Author     : Nhan
--%>

<%@page import="com.Checker"%>
<%@page import="com.Book"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%
    String bookID = request.getParameter("bookID");
    Book curBook = null;
    if(bookID != null) {
        curBook = Checker.getBookInfo(bookID);
        }
    %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Details of: <%= curBook.getTitle() %></title>
            
    </head>
    <body>
           <% if(curBook != null) { %>
                <h3>You are current at: </h3>
                <div class="bookInfo">
                    <table>
                        <tr>
                            <td rowspan="5">
                                <img src="images/<%= curBook.getImage()  %>" alt="Image description" />
                            </td>
                            <td>
                                <strong>Title: </strong> <%= curBook.getTitle() %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>Author: </strong> <%= curBook.getAuthor() %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>Type: </strong> <%= curBook.getType() %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <strong>Price: </strong> <%= curBook.getPrice() %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <form action="centralUnit" method="GET">
                                   <input type="hidden" name="bookID" value="<%=  curBook.getId() %>" />
                                   <input type="submit" name="action" value="Add To Cart" size="" />
                                </form>
                            </td>
                        </tr>
        
                    </table>
                    
                </div>

            <% } else { %>
                <h3>You must select a book to view!</h3>
            <%
            }
        %>
    </body>
</html>
